package com.mm.controller;

import com.mm.domain.User;
import com.mm.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;

/**
 * 用于Thymeleaf的编程参考
 */
@Controller
public class ThymeleafController {
    @Autowired
    private UserRepository userRepository;

    @RequestMapping(value = "/testThymeleaf")
    public String test(ModelMap model){
        List<User> list = userRepository.findAll();
        model.addAttribute("users",list);
        return "thymeleaf";
    }
}
